package application;
	
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.stage.Stage;
import util.Base64;
import util.EncryptionSimpleUtil;
import util.HardwareUtil;
import javafx.scene.Parent;
import javafx.scene.Scene;


public class Main extends Application {
	@Override
	public void start(Stage primaryStage) {
		try {
			FXMLLoader fXMLLoader = new FXMLLoader(getClass().getResource("main.fxml"));
			Parent root = fXMLLoader.load();
			MainController controller = fXMLLoader.getController();
			controller.setPrimaryStage(primaryStage);
			controller.init();
			Scene scene = new Scene(root);
			primaryStage.setScene(scene);
			primaryStage.show();
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	
	private static void hardwareInit() {
		try {
			System.out.println("MAC:"+Base64.getEncoder((HardwareUtil.getMACAddress())));
			System.out.println("CPU:"+Base64.getEncoder(HardwareUtil.getCPUSerial()));
			
			System.out.println("MAC:"+EncryptionSimpleUtil.EncryptionStr(HardwareUtil.getMACAddress(), EncryptionSimpleUtil.MD5));
			System.out.println("CPU:"+EncryptionSimpleUtil.EncryptionStr(HardwareUtil.getCPUSerial(),EncryptionSimpleUtil.MD5));
		}catch (Exception e) {
			
		}
	}
	
	public static void main(String[] args) {
		try {
			hardwareInit();
			launch(args);
		} catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
		System.exit(1);
	}
}
